package com.visual.core.filter;

import com.visual.core.domain.BladeVisual;
import com.visual.util.filter.QueryWrapperContext;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

/**
 * 关系型数据实体[BladeVisual] 查询条件对象
 */
@Slf4j
@Data
public class BladeVisualSearchContext extends QueryWrapperContext<BladeVisual> {

	private String n_title_like;//[大屏标题]
	public void setN_title_like(String n_title_like) {
        this.n_title_like = n_title_like;
        if(!ObjectUtils.isEmpty(this.n_title_like)){
            this.getSearchCond().like("title", n_title_like);
        }
    }
	private Integer n_category_eq;//[大屏类型]
	public void setN_category_eq(Integer n_category_eq) {
        this.n_category_eq = n_category_eq;
        if(!ObjectUtils.isEmpty(this.n_category_eq)){
            this.getSearchCond().eq("category", n_category_eq);
        }
    }

    /**
	 * 启用快速搜索
	 */
    @Override
	public void setQuery(String query)
	{
		 this.query=query;
		 if(!StringUtils.isEmpty(query)){
            this.getSearchCond().and( wrapper ->
                     wrapper.like("title", query)
            );
		 }
	}
}



